//
// Created by Wirano on 2020/11/9.
//

#ifndef ANO_PORT_ANO_SENSOR_BASIC_H
#define ANO_PORT_ANO_SENSOR_BASIC_H

//==引用
#include "Ano_FcData.h"

//==定义
#define OFFSET_AV_NUM 50
#define GRAVITY_ACC_PN16G    2048
#define RANGE_PN2000_TO_RAD  0.001065f
#define RANGE_PN16G_TO_CMSS  0.4790f

//==数据声明
typedef struct
{
	float center_pos_cm[VEC_XYZ];
	float gyro_rad[VEC_XYZ];
	float gyro_rad_old[VEC_XYZ];
	float gyro_rad_acc[VEC_XYZ];
	float linear_acc[VEC_XYZ];
}_center_pos_st;
extern _center_pos_st center_pos;



typedef struct
{
  uint8_t surface_CALIBRATE;
	float surface_vec[VEC_XYZ];
	float surface_unitvec[VEC_XYZ];
	
}_sensor_rotate_st;
extern _sensor_rotate_st sensor_rot ;

typedef struct 
{
	uint8_t acc_CALIBRATE;//加速度校准标志位
	uint8_t gyr_CALIBRATE;//陀螺仪校准标志位
	uint8_t acc_z_auto_CALIBRATE;//加速度计z轴校准标志位
	
	int16_t Acc_Original[VEC_XYZ];
	int16_t Gyro_Original[VEC_XYZ];
	
	int16_t Acc[VEC_XYZ];
	int32_t Acc_cmss[VEC_XYZ];
	float Gyro[VEC_XYZ];
	float Gyro_deg[VEC_XYZ];
	float Gyro_rad[VEC_XYZ];

	int16_t Tempreature;
	float Tempreature_C;
	
}_sensor_st;//__attribute__((packed)) 

extern _sensor_st sensor;

//==函数声明

//static
void Center_Pos_Set(void);

//public
void Sensor_Data_Prepare(uint8_t dT_ms);
void Sensor_Basic_Init(void);

#endif //ANO_PORT_ANO_SENSOR_BASIC_H
